const connection = require('../app/database')

class PermissionService {
    async checkResource(resourceName, resourceId, userId) {
        const statement = `SELECT * FROM ${resourceName} WHERE id = ? AND user_id = ?`
        // 3.执行sql语句
        const [result] = await connection.execute(statement, [resourceId, userId])
        return !!result.length
    }
}
module.exports = new PermissionService()